MkDetailsBlock
:fa-brands-github: Show source on GitHub
Pymdownx-based details box.¶
Bases: MkBlock
__init__
¶
__init__(
content: str | list | MkNode | None = None,
*,
typ: AdmonitionTypeStr = "info",
expanded: bool | None = None,
title: str | None = None,
**kwargs: Any
) -> None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
str | list | MkNode | None
|
Admonition content |
None
|
typ
|
AdmonitionTypeStr
|
Admonition type |
'info'
|
expanded
|
bool | None
|
Whether the details block should be expanded initially |
None
|
title
|
str | None
|
Optional Admonition title |
None
|
kwargs
|
Any
|
Keyword arguments passed to parent |
{}
|
| Name | Children | Inherits |
|---|---|---|
| MkBlock mknodes.basenodes.mkblock PyMdown-based block. |
graph TD
3959722705["mkdetailsblock.MkDetailsBlock"]
1483073837["mkblock.MkBlock"]
835538629["mkcontainer.MkContainer"]
1956333208["mkcontainer.MkContainerBase"]
1359323199["mknode.MkNode"]
2751680898["builtins.object"]
1483073837 --> 3959722705
835538629 --> 1483073837
1956333208 --> 835538629
1359323199 --> 1956333208
2751680898 --> 1359323199
/home/runner/work/mknodes/mknodes/src/mknodes/basenodes/mkdetailsblock/metadata.toml
[metadata]
icon = "octicon:info-16"
name = "MkDetailsBlock"
[requirements.extension."pymdownx.blocks.details"]
[examples.regular]
title = "Regular"
jinja = """
{{ "Different types." | MkDetailsBlock(typ="warning") }}
"""
[examples.collapsible]
title = "Collapsible and expandable"
jinja = """
{{ "MkDetailsBlocks can also be expanded." | MkDetailsBlock(expanded=True) }}
"""
[output.markdown]
template = """
{{ node.fence_boundary }} details{% if node.argument %}" | " ~ {{ node.argument }}{% endif %}
type: {{ node.typ }}
{% if node.expanded %} open: True
{% endif %}
{{ node.get_items() | join }}
{{ node.fence_boundary }}
"""